<?php if ( ! defined('ABS_PATH')) exit('ABS_PATH is not loaded. Direct access is not allowed.');


    class SiteInfo extends DAO
    {
        private static $instance ;
        private $site_info ;

        public static function newInstance() {
            if(!self::$instance instanceof self) {
                self::$instance = new self ;
            }
            return self::$instance ;
        }

        public function __construct() {
            $this->createMetadataConnection() ;
            $this->toArray() ;
        }

        public function getTableName() {
            return 'tbl_sites' ;
        }

        public function toArray() {
            $domain = $_SERVER['HTTP_HOST'] ;
            $this->site_info = $this->findByPrimaryKeyInMetadataDB($domain) ;
        }

        public function get($key) {
            if (!isset($this->site_info[$key])) {
                return '' ;
            }
            return ($this->site_info[$key]) ;
        }
    }

?>